<template>
  <Field
    v-if="showType === 'edit'"
    :border="border"
    :name="name"
    :label="label"
    :labelWidth="labelWidth"
    :disabled="disabled"
    :placeholder="placeholder"
    :type="type"
    :rules="rules"
  >
    <template #input>
      <van-stepper v-model="currentValue" @change="$emit('change', currentValue, name)" />
    </template>
  </Field>
  <Field
    v-else-if="showType === 'view'"
    :border="border"
    :name="name"
    :readonly="true"
    :value="viewValueFn(currentValue)"
    :label="label"
    :labelWidth="labelWidth"
    type="input"
  >
    <template #button>
      <slot></slot>
    </template>
  </Field>
</template>

<script>
import common from './item'
import { Stepper } from 'vant'
export default {
  mixins: [common],
  components: {
    vanStepper: Stepper
  }
}
</script>
